from machine import ADC
import time
from machine import Pin
ledB=Pin(13,Pin.OUT)          #create LED object from pin2,Set Pin2 to output
ledR=Pin(15,Pin.OUT)
ledG=Pin(12,Pin.OUT) 
adc0=ADC(0)                     #鍒涘缓ADC 浣跨敤adc0

while True:
  ad=adc0.read()    #read value, 0-1024
  if ad>200:
    ledB.value(0)
  else:
      ledB.value(1)
  time.sleep(0.1)
